#ifndef KERN_VM_H
#define KERN_VM_H

#include <stdint.h>
#include "proc.h"

uint64_t *pgdir_walk(uint64_t *pgdir, const void *va, int64_t alloc);
int map_region(uint64_t *pgdir, void *va, uint64_t size, void *pa, int64_t perm);
uint64_t *vm_copy(uint64_t *pgdir, int level);
void vm_free(uint64_t *pgdir, int level);
void uvm_switch(struct proc *p);
int uvm_init(uint64_t *pgdir, char *binary, int sz);
int uvmmap(uint64_t *pgdir, char *data, uint64_t start, uint64_t size, uint64_t pte_flags);

uint64_t *pgdir_init();
uint64_t *pgdir_access(uint64_t *pgdir, uint64_t va, char **p_page);

#endif